< Prev(J) / Next(K) > / View :

Filename: /text/scalc/guide/userdefined_function.xhp

(bookmark: bm_id3155411)
functions; user-defined
user-defined functions
Basic IDE for user-defined functions
IDE; Basic IDE
programming;functions

関数; ユーザー定義
ユーザー定義の関数
ユーザー定義関数の Basic IDE
IDE; Basic IDE
プログラミング;関数

(variable: userdefined_function)User-Defined Functions
(variable: userdefined_function)ユーザー定義の関数(hd_id3155411.1)

You can apply user-defined functions in Office Calc in the following ways:
ユーザー定義の関数は、Office Calc で次のように操作します:(par_id3153969.2)

Defining A Function Using Office Basic
独自の関数を Office Basic で定義する(hd_id3149260.6)

  1. Choose Tools - Macros - Organize Macros - Office Basic.
    ツール → マクロ → マクロの管理 → Office Basic を選択します。(par_id3148456.7)

  2. Click the Edit button. You will now see the Basic IDE.
    編集 ボタンをクリックして Basic-IDE を開きます。(par_id3154510.8)

  3. Enter the function code. In this example, we define a VOL(a; b; c) function that calculates the volume of a rectangular solid with side lengths a, b and c:
    関数コードを入力します。ここでは、VOL(a; b; c) 関数を指定します。この関数は、辺の長さが ab、および c の直方体の体積を計算します。(par_id3150327.9)

    Function VOL(a, b, c)
    VOL = a*b*c
    End Function(par_id9797426.)

  4. Close the Basic-IDE window.
    Basic-IDE ウィンドウを閉じます。(par_id3155443.10)

    Your function is automatically saved in the default module and is now available. If you apply the function in a Calc document that is to be used on another computer, you can copy the function to the Calc document as described in the next section.
    ユーザーが定義した関数は自動的に標準モジュールに保存されるので、いつでも使用できます。この関数を別のコンピュータの Calc ドキュメントでも使用できるようにするには、関数を Calc ドキュメントにコピーします。次の節で詳細が説明されています。(par_id3150043.11)

Copying a Function To a Document
独自の関数をドキュメントにコピーする(hd_id3147340.18)

In stage 2 of "Defining A Function Using Office Basic", in the Macro dialog you clicked on Edit . As the default, in the Macro from field the My Macros - Standard - Module1 module is selected. The Standard library resides locally in your user directory.
「独自の関数を Office Basic で定義する」の手順 2 で マクロ ダイアログの 編集 をクリックしました。標準設定では マイマクロ → Standard → Module1マクロの記録先 が選択されています。この Standard ライブラリは、ユーザーディレクトリにあります。(par_id3145232.19)

If you want to copy the user-defined function to a Calc document:
ユーザーが定義した関数を Calc ドキュメントにコピーするには、次の操作を行ないます:(par_id3154022.20)

  1. Choose Tools - Macros - Organize Macros - Office Basic .
    ツール → マクロ → マクロの管理 → Office Basic を選択します。(par_id3150304.21)

  2. In the Macro from field select My Macros - Standard - Module1 and click Edit.
    マクロの記録先 フィールドから マイマクロ → Standard → Module1 を選択した上で 編集 ボタンをクリックします。(par_id3150086.22)

  3. In the Basic-IDE, select the source of your user-defined function and copy it to the clipboard.
    Basic-IDE でユーザーが定義した関数のソースを選択して、クリップボードにコピーします。(par_id3166430.23)

  4. Close the Basic-IDE.
    Basic-IDE を閉じます。(par_idN1081D.)

  5. Choose Tools - Macros - Organize Macros - Office Basic .
    ツール → マクロ → マクロの管理 → Office Basic を選択します。(par_id3150517.24)

  6. In the Macro from field select (Name of the Calc document) - Standard - Module1. Click Edit.
    マクロの記録先 フィールドから (Calc ドキュメント名) → Standard → Module1 を選択して 編集 ボタンをクリックします。(par_id3145384.25)

  7. Paste the clipboard contents in the Basic-IDE of the document.
    ドキュメントの Basic-IDE にクリップボードの内容を貼り付けます。(par_id3148699.26)

Applying a User-defined Function in Office Calc
独自の関数を Office Calc で適用する(hd_id3153305.12)

Once you have defined the function VOL(a; b; c) in the Basic-IDE, you can apply it the same way as the built-in functions of Office Calc.
Basic-IDE で定義した関数 VOL(a; b; c) は、Office Calc のほかの組み込み関数と同じ方法で使用できます。(par_id3148869.13)

  1. Open a Calc document and enter numbers for the function parameters a, b, and c in cells A1, B1, and C1.
    Calc ドキュメントを開いて、セル A1、B1、および C1 に関数の引数の数値である ab、および c を入力します。(par_id3148606.14)

  2. Set the cursor in another cell and enter the following:
    カーソルを別のセルに置き、次のように入力します:(par_id3156019.15)

    =VOL(A1;B1;C1)
    =VOL(A1;B1;C1)(par_id3155264.16)

  3. The function is evaluated and you will see the result in the selected cell.
    関数が適用され、結果が選択したセルに表示されます。(par_id3146776.17)

(embed text/scalc/guide/calculate.xhp#calculate : linkinfo)

Calculating in Spreadsheets
表計算ドキュメントで計算する(hd_id3150791.25)

(/embed text/scalc/guide/calculate.xhp#calculate)

(embed text/scalc/guide/formula_enter.xhp#formula_enter : linkinfo)

Entering Formulas
数式を入力する(hd_id3150868.9)

(/embed text/scalc/guide/formula_enter.xhp#formula_enter)


< Prev / Next >